<template>
  <el-dialog
    title="日志内容"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" ref="dataForm"
             label-width="80px">
      <el-form-item label="内容详情" prop="name">
        <el-input type="textarea" :rows="8" v-model="dataForm.logContent" placeholder=""></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data () {
    return {
      visible: false,
      dataForm: {
        logContent: ''
      }
    }
  },
  methods: {
    init (data, visible, type) {
      let url = ''
      if (type === 'sys') {
        url = '/system/log/content/' + data.id
      } else {
        url = '/operate/log/content/' + data.id
      }
      this.$http({
        url: url,
        method: 'get'
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.dataForm.logContent = data.content
          this.visible = visible
        }
      })
    }
  }
}
</script>